package com.example.superoa.model.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.example.superoa.model.dao.JobchageDao;
import com.example.superoa.model.mappers.JobchageMapper;
import com.example.superoa.model.pojos.Department;
import com.example.superoa.model.pojos.Jobchage;

@Service
@Transactional(rollbackFor=Exception.class)
public class JobchageService {
	@Autowired
	private JobchageMapper jobchagemapper;
	@Autowired
	private JobchageDao jobchagedao;
	//查询职务信息
	public List<Jobchage> jobchageAll(){
		return jobchagemapper.jobchageAll();
	}
	
	//新增职务
	public void addjobchage(Jobchage j) {
		jobchagedao.save(j);
	}
	
	//删除部门根据id
	public void deletedepartmentid(int jobchageId){
		System.err.println(jobchageId);
		jobchagedao.deleteById(jobchageId);
	}
	//获取职务编辑数据
	public Jobchage jobchageById(int jobchageId) {
		return jobchagemapper.jobchageById(jobchageId);
	}
	//编辑职务信息
	public void jobchageedit(Jobchage jj) {
		Jobchage j=jobchagedao.findById(jj.getJobchageId()).get();
		j.setJobchageName(jj.getJobchageName());
		j.setJobchage_Rank(jj.getJobchage_Rank());
	}
}



